<!--
 列表组件，用于首页、全部商品页面的商品列表
 -->
<template>
  <div id="myList" class="myList clearFix" >
    <!-- 全部商品 -->
    <ul>
      <li v-for="(p,index) in data" :key="index" @click="goParticulars(p.product_id)">
        <el-popover placement="top">
          <p>确定删除吗？</p>
          <div style="text-align: right; margin: 10px 0 0">
            <el-button type="primary" size="mini">确定</el-button>
          </div>
          <i class="el-icon-close delete" slot="reference"></i>
        </el-popover>
          <img :src="p.product_picture"/>
          <h2>{{p.product_name}}</h2>
          <h3>{{p.product_intro}}</h3>
          <p>
            <span>1999元</span>
            <span
              class="del"
            >2000元</span>
          </p>
      </li>
    </ul>
  </div>
</template>
<script>
export default {
  name: "MyList",
  data(){
    return {
     
    }
  },
  methods: {
    // 点击每一个商品,query带参跳转到详情页
    goParticulars(id){
      this.$router.push({
        name:'details',
        query: {id}
      })
    }
    
  },
  props:["data"]
};
</script>
<style scoped>
.myList ul li {
  /* z-index: 1; */
  float: left;
  /* display: flex; */
  width: 230px;
  height: 280px;
  padding: 10px 0;
  margin: 0 0 14.5px 13.7px;
  background-color: white;
  -webkit-transition: all 0.2s linear;
  transition: all 0.2s linear;
}
.myList ul li:hover {
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
  transform: translate3d(0, -10px, 0);
}
.myList ul li img {
  display: block;
  width: 160px;
  height: 160px;
  background: url(../../assets/imgs/placeholder.png) no-repeat 50%;
  margin: 0 auto;
}
.myList ul li h2 {
  margin: 25px 10px 0;
  font-size: 14px;
  font-weight: 400;
  color: #333;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.myList ul li h3 {
  margin: 5px 10px;
  height: 18px;
  font-size: 12px;
  font-weight: 400;
  color: #b0b0b0;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.myList ul li p {
  margin: 10px 10px 10px;
  text-align: center;
  color: #ff6700;
}
.myList ul li p .del {
  margin-left: 0.5em;
  color: #b0b0b0;
  text-decoration: line-through;
}
.myList #more {
  text-align: center;
  line-height: 280px;
}
.myList #more a {
  font-size: 18px;
  color: #333;
}
.myList #more a:hover {
  color: #ff6700;
}
.myList ul li .delete {
  position: absolute;
  top: 10px;
  right: 10px;
  display: none;
}
.myList ul li:hover .delete {
  display: block
}
.myList ul li .delete:hover {
  color: #ff6700;
}
</style>